#!/usr/bin/env python

import serial
import string
import time
import urllib


rot13 = string.maketrans( 
    "ABCDEFGHIJKLMabcdefghijklmNOPQRSTUVWXYZnopqrstuvwxyz", 
    "NOPQRSTUVWXYZnopqrstuvwxyzABCDEFGHIJKLMabcdefghijklm")

test=serial.Serial("/dev/ttyAMA0",9600,8,parity='N',stopbits=1,timeout=1)
test.open()
test.flush()



try:
    while True:
        line = test.readline()
        print test.getCTS()
        print test.getDSR()
        # rint test.readline 
        print line
        test.flushOutput()
        time.sleep(5)
        urllib.urlopen("http://192.168.0.5/JCult/index.php?service=newObs&temp=2.0&hum=10&pres=5500&lum=870")
    
except KeyboardInterrupt:
    pass # do cleanup here
    test.flush()
    print 'END'
test.close()
